package pl.edu.agh.uddiProxy;

import pl.edu.agh.uddiProxy.query.SaveTModelQuery;
import pl.edu.agh.uddiProxy.types.TModel;
import dk.itst.uddi.client.query.SaveBindingQuery;
import dk.itst.uddi.client.query.SaveBusinessQuery;
import dk.itst.uddi.client.query.SaveServiceQuery;
import dk.itst.uddi.client.types.core.BindingTemplate;
import dk.itst.uddi.client.types.core.BusinessEntity;
import dk.itst.uddi.client.types.core.BusinessService;

public class PublicationClient {
	private dk.itst.uddi.client.PublicationClient publicationClient;

	protected PublicationClient(dk.itst.uddi.client.PublicationClient publicationClient) {
		this.publicationClient = publicationClient;
	}

	public void deleteBinding(String bindingKey) {
		publicationClient.deleteBinding(bindingKey);
	}
	
	public void deleteBindings(String[] bindingKeys) {
		publicationClient.deleteBindings(bindingKeys);
	}
	
	public void deleteBusiness(String businessKey) {
		publicationClient.deleteBusiness(businessKey);
	}
	
	public void deleteBusinesses(String[] keys) {
		publicationClient.deleteBusinesses(keys);
	}
	
	public void deleteService(String serviceKey) {
		publicationClient.deleteService(serviceKey);
	}
	
	public void deleteServices(String[] keys) {
		publicationClient.deleteServices(keys);
	}
	
	public void deleteTModel(String tModelKey) {
		publicationClient.deleteTModel(tModelKey);
	}
	
	public void deleteTModels(String[] keys) {
		publicationClient.deleteTModels(keys);
	}
	
	public SaveBindingQuery saveBinding() {
		return publicationClient.saveBinding();
	}
	
	public SaveBindingQuery saveBinding(BindingTemplate t) {
		return publicationClient.saveBinding(t);
	}
	
	public SaveBusinessQuery saveBusiness() {
		return publicationClient.saveBusiness();
	}
	
	public SaveBusinessQuery saveBusinessEntity(BusinessEntity business) {
		return publicationClient.saveBusinessEntity(business);
	}
	
	public SaveServiceQuery saveService() {
		return publicationClient.saveService();
	}
	
	public SaveServiceQuery saveService(BusinessService service) {
		return publicationClient.saveService(service);
	}
	
	public SaveTModelQuery saveTModel() {
		return new SaveTModelQuery(publicationClient.saveTModel(), null);
	}
	
	
	/**
	 * @param model TModel to save in UDDI
	 * @return query to save TModel
	 */
	public SaveTModelQuery saveTModel(TModel model) {
		dk.itst.uddi.client.query.SaveTModelQuery modelQuery = publicationClient.saveTModel(model.getModel());
		return new SaveTModelQuery(modelQuery, model);
	}
}
